import { useReducer } from 'react';

export default initState => {
    const _reducer = (state, payload) => ({
        ...state,
        ...payload,
    });

    const [state, dispatch] = useReducer(_reducer, initState);

    return [state, dispatch];
};
